/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DataMobil;

/**
 *
 * @author SETYO RESMI
 */
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Admin
 */
public class JadwalTableModel extends AbstractTableModel {

    private List<DataSewa> sewa = new ArrayList<DataSewa>();

    public JadwalTableModel(List<DataSewa> sewa) {
        this.sewa = sewa;
    }

    public int getRowCount() {
        return sewa.size();
    }

    public int getColumnCount() {
        return 6;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        DataSewa s = sewa.get(rowIndex);
        switch (columnIndex) {
            case 0:

                return s.getId_mobil();
            case 1:
                return s.getNama_mobil();

            case 2:
                return s.getId_penyewa();
            case 3:
                return s.getNama_penyewa();
            case 4:
                return s.getTgl_sewa();
            case 5:
                return s.getTgl_kembali();


            default:
                return "";
        }
    }

    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "IDMobil";
            case 1:
                return "Nama Mobil";
            case 2:
                return "ID Penyewa";
            case 3:
                return "Nama Penyewa";
            case 4:
                return "Pinjam";
            case 5:
                return "Kembali";
            default:
                return "";
        }
    }
}
